package cn.rc.rcsystem.fallback;

import cn.rc.rcsystem.exception.GlobalExceptionCodeEnum;
import cn.rc.rcsystem.feign.CarRentalService;
import cn.rc.rcsystem.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CarRentalServiceFallbackFactory implements FallbackFactory<CarRentalService> {
    @Override
    public CarRentalService create(Throwable throwable) {
        return new CarRentalService() {
            @Override
            public JSONResult charter(Long shopId, String carNumber) {
                return JSONResult.error(GlobalExceptionCodeEnum.FALLBACK);
            }
        };
    }
}
